# -*- coding: utf-8 -*-

from pylot.core import check_type
from pylot.interfaces.iohandler import IOHandlerInterface

class Speaker (object):
  def __init__ (self, io_handler, name):
    u"""
    A very simple speaker who can only says "Hello world"
    This speaker is compatible with Qt interface thanks to io_handler use.

    :param io_handler: io handler used for writting 
    :type io_handler: :class:`~pylot.interfaces.iohandler.IOHandlerInterface`
    :param name: speaker name
    :type name: unicode
    """
    check_type(u'io_handler', io_handler, IOHandlerInterface)
    check_type(u'name', name, unicode)

    self.io = io_handler
    self.name = name

  def sayHelloWorld (self,):
    self.io.write(u"%s says: Hello world !\n" % self.name)

